package com.thoughtworks.biblioteca.command;

import com.thoughtworks.biblioteca.controller.BookController;
import com.thoughtworks.biblioteca.util.ConsoleUtil;

public class CheckOutBook implements ICommand {
    private BookController bookController;
    private ConsoleUtil consoleUtil;

    public void doExecute() {
        checkOutBook();
    }

    private void checkOutBook() {
        int choosedBookID = choosedBookID();
        printCheckoutResult(choosedBookID);
    }

    private void printCheckoutResult(int bookID) {
        System.out.println(bookController.checkoutResult(bookID));
    }

    private int choosedBookID() {
        System.out.println(" Please enter the number of the book you wish to checkout: ");
        return consoleUtil.getNumberFromConsole();
    }


    public BookController getBookController() {
        return bookController;
    }

    public void setBookController(BookController bookController) {
        this.bookController = bookController;
    }

    public ConsoleUtil getConsoleUtil() {
        return consoleUtil;
    }

    public void setConsoleUtil(ConsoleUtil consoleUtil) {
        this.consoleUtil = consoleUtil;
    }
}
